package com.springboot.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * 项目配置文件
 *
 * @author supu
 * @date 2019-08-09 9:29
 **/
@Configuration
public class ProviderConfig {
    @Autowired
    private Environment environment;
    /**
     * zookeeper 配置
     */
    public static final String ZOOKEEPER_ADDRESS = "zookeeper.address";
    public static final String ZOOKEEPER_GROUP = "zookeeper.group";
    public static final String ZOOKEEPER_SESSION_TIMEOUT = "zookeeper.session.timeout";
    public static final String ZOOKEEPER_CONNECTION_TIMEOUT = "zookeeper.connection.timeout";
    public static final String ZOOKEEPER_MAX_RETRY_COUNT = "zookeeper.max.retry.count";
    public static final String ZOOKEEPER_CLIENT_SLEEP = "zookeeper.client.sleep";

    /**
     * dubbo 配置
     */
    public static final String DUBBO_REGISTRY_ADDRESS = "dubbo.registry.address";
    public static final String DUBBO_MONITOR_ADDRESS = "dubbo.monitor.address";
    public static final String DUBBO_PROTOCOL_NAME = "dubbo.protocol.name";
    public static final String DUBBO_PROTOCOL_PORT = "dubbo.protocol.port";
    public static final String DUBBO_APPLICATION_ENVIRONMENT = "dubbo.application.environment";
    public static final String DUBBO_APPLICATION_PROVIDER_NAME = "dubbo.application.provider.name";
    public static final String DUBBO_APPLICATION_CONSUMER_NAME = "dubbo.application.consumer.name";
    public static final String DUBBO_MONITOR_ISNEED = "dubbo.monitor.isNeed";
    public static final String DUBBO_GROUP = "dubbo.group";
    public static final String DUBBO_TIMEOUT = "dubbo.timeout";

    /**
     * kafka 配置
     */
    public static final String KAFKA_TOPIC_USER = "kafka.topic.user";

    /**
     * rabbitMq 配置
     */
    public static final String RABBITMQ_QUEUE_NAME = "rabbitmq.queue.name";
    public static final String RABBITMQ_EXCHANGE_NAME = "rabbitmq.exchange.name";
    public static final String RABBITMQ_ROUTING_KEY = "rabbitmq.routing.key";

    public String getString(String key){
        return environment.getProperty(key);
    }
}
